/*
 * MockThread.h
 *
 *  Created on: Feb 7, 2012
 *      Author: hzheng
 */

#ifndef MOCKTHREAD_H_
#define MOCKTHREAD_H_
#include "Thread.h"
#include "gtest/gtest.h"


namespace NS_LCD_AFW
{

class CMockThread: public CThread
{
public:
	CMockThread(bool bAutoDelete):CThread(bAutoDelete){m_bRun = true;}
	CMockThread(){m_bRun = true;}
	virtual void run()
	{
		m_sleepTime = 5;
		while(m_bRun)
		{
			if (m_sleepTime-- > 0)
			{
				sleep(1);
			}
			else
			{
				break;
			}
		}
	}
	virtual int stop()
	{
		m_bRun = false;
		while(this->isRunning())
		{

		}
		return 0;
	}
public:
	volatile bool m_bRun;
	int m_sleepTime;
};
}

#endif /* MOCKTHREAD_H_ */
